﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Willson.JsbManager.Comm;

namespace Willson.JsbManager.UI
{
    public partial class ComputerHbForm : Form
    {

        private XTCompanySbMonthInputForm form = null;
        
        public ComputerHbForm(XTCompanySbMonthInputForm form)
        {
            InitializeComponent();
            this.form = form;
        }

        private void bt_comput_Click(object sender, EventArgs e)
        {
            int m_hb = 0;
            int m_begin = 0;
            int m_cjs = 0;
            int m_ysl = 0;
            
            if (string.IsNullOrEmpty(mtb_begin.Text))
            {
                MessageUtil.ShowWarning("请输入上月抄机数!");
                mtb_begin.Focus();
                return;
            }

            if (string.IsNullOrEmpty(mtb_cjs.Text))
            {
                MessageUtil.ShowWarning("请输入本月抄机数!");
                mtb_cjs.Focus();
                return;
            }

            if (string.IsNullOrEmpty(mtb_ysl.Text))
            {
                MessageUtil.ShowWarning("请输入本月用水量!");
                mtb_ysl.Focus();
                return;
            }

            m_begin = Convert.ToInt32(mtb_begin.Text);
            m_cjs = Convert.ToInt32(mtb_cjs.Text);
            m_ysl = Convert.ToInt32(mtb_ysl.Text);

            m_hb = m_ysl - m_cjs + m_begin;

            mtb_hb.Text = m_hb.ToString();

        }

        private void bt_input_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(mtb_hb.Text))
            {
                MessageUtil.ShowWarning("请输入换表度数!");
                mtb_hb.Focus();
                return;
            }

            form.InputHbNumber(Convert.ToInt32(mtb_hb.Text));

            Close();

        }
    }
}
